<?php
/**
 * XuYuan Project
 *
 * @package	XueYuan 
 * @author	Jiuchi Team
 * @since	Version 1.0.0
 * @filesource
 */
defined('BASEPATH') OR exit('No direct script access allowed');
/**
 * User model class
 * @author Wayne Yu
 */
class User_model extends Jiuchi_Model{
	/**
	 * Construct function
	 */
	public function __construct() {
		parent::__construct();
		$this->table = 'user';
	}
	
	/**
	 * Get user info by telephone
	 * @param unknown $account
	 * @return Ambigous <mixed, boolean, unknown>
	 */
	public function getUserByAccount($account){
		return $this->getInfo($account, 'telephone');
	}
	
	/**
	 * Get user status array
	 * @return array
	 */
	public function getUserStatus(){
		return array(
				0	=>	'未激活',
				1	=>	'已激活',
				2	=>	'已锁定'
		);
	}
	
	/**
	 * Check user status
	 * @return boolean
	 */
	public function checkUserStatus($status){
		if($status == 1){
			return TRUE;
		} else{
			return FALSE;
		}
	}
	
	/*----------------------------------------------------*/
	/**
	 * Admin
	 */
	public function getAllUser(){
		$count = -1;
		return $this->retrieve($count, NULL, NULL, NULL, array('deleted'=>0), NULL, NULL, NULL, array());
	}
}